home *** CD-ROM | disk | FTP | other *** search
- Path: news.pi.net!news
- From: mv@pi.net
- Newsgroups: comp.lang.c
- Subject: ** Serial Number problem **
- Date: 12 Feb 1996 21:10:24 GMT
- Organization: IBM OS/2 Warp
- Message-ID: <4foac0$hq1@neptunus.pi.net>
- Reply-To: mv@pi.net
- NNTP-Posting-Host: asd46.pi.net
- X-Newsreader: IBM NewsReader/2 v1.03
-
- Hello everybody,
-
-
- Please take a look at the following 'problem':
-
-
- The function below should say 'Ok !' when it has succesfully read a disks serial-number.
- As it shown below the function says 'No serial number !' which means that the carry-flag is
- set during the execution of the interrupt.
- This doesn't make any sense, but it gets even worse. if I leave out the 'char *no' declaration in
- the function prototype the function DOES work as it should...
-
- ----------------------------------------------------------------------------
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <dos.h>
-
-
- void get_disk_serial(unsigned char disk, char *no)
-
- {
- union REGS regs;
- struct SREGS seg;
-
- regs.x.ax=0x6900;
- regs.h.bl=disk
- segread(&seg);
- intdosx(®s, ®s, &seg);
- if (regs.x.cflag)
- {
- printf("No serial number !\n");
- } else printf("Ok !\n");
- }
-
-
-
- int main (void)
-
-
- {
- char *s[10];
- get_disk_serial(1,s);
- return 0;
- }
-
-
- --------------------------------------------------------------------------------
-
-
- I've tried to figure out what is wrong here, but I just recently started programming in C after quitting
- with Turbo Pascal, but these things drive me nuts...
-
- I've used the Snippets to help me underway, but I can't see the usefullnes of SEGREAD(), the
- Turbo C++ helpfunction and accompanying book don't tell that much....
- In my opinion you use this function to place the segment registers in a variable after a call to
- intdosx (or something like that), but it's prosition puzzles me...
-
-
- Could anybody please help ?
-
-
- TTYL,
-
- Martijn :-)
-
-